export function mergeChartOption(
  obj1: Record<string, any>,
  obj2: Record<string, any>
) {
  obj1 = { ...obj1 };
  for (let key in obj2) {
    if (
      typeof obj1[key] === "object" &&
      obj1[key] !== null &&
      typeof obj2[key] === "object" &&
      obj2[key] !== null
    ) {
      if (Array.isArray(obj2[key])) {
        let oldItem = Array.isArray(obj1[key]) ? obj1[key] : [];
        obj1[key] = (obj2[key] as Array<any>).map((t, i) => {
          let item = oldItem[i] || oldItem[0] || {};
          if (typeof t === "object" && t !== null) {
            return mergeChartOption(item, t);
          } else {
            return t;
          }
        });
      } else {
        obj1[key] = mergeChartOption(obj1[key], obj2[key]); // 递归合并子对象
      }
    } else {
      obj1[key] = obj2[key];
    }
  }

  return obj1;
}
export function getUnit(text = "单位：万元") {
  return {
    text,
    right: "4%",
    top: "4%",
    textStyle: {
      fontSize: 11,
      color: "#fff",
      fontWeight: "normal",
    },
  };
}
